using System.ServiceProcess;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Iit.ITBI.MDSManager;
using Enterprise.Statistics.WindowsServices.Common.Log;


namespace Iit.ITBI.MDSManagerService
{
	static class Program
	{
		static void Main()
		{

            NLogWriter.WriteLogger("Info", null, "******************************************************************************************************");
            NLogWriter.WriteLogger("Info", null, "Starting service.");

            NLogWriter.WriteLogger("Error", null, "Testing Error Output.");
            NLogWriter.WriteLogger("Warning", null, "Testing Warning Output.");

#if DEBUG

            NLogWriter.WriteLogger("Info", null, "In debug mode starting visual debug form");
            try
            {
                DebugForm debugForm = new DebugForm();
                debugForm.ShowDialog();
            }
            catch(Exception e)
            {
                NLogWriter.WriteLogger("Error", null, "Debug mode failed to start." + e.Message);
                
                throw;
            }

#else
            NLogWriter.WriteLogger("Info", null, "In service mode starting the service MDSManagerService");
            try
            {
                ServiceBase service = new MDSManagerService();
                ServiceBase.Run(service);
            }
            catch(Exception e)
            {
                NLogWriter.WriteLogger("Error", null, "Failed to start the service." + e.Message);
                
                throw;
            }
#endif

        }
	}
}